package demo1;

public class test02 {
    public static void main(String[] args) {
        RoadVehicle roadVehicle = new RoadVehicle();
        roadVehicle.run("汽车");

        AirVehicle airVehicle = new AirVehicle();
        airVehicle.run("飞机");
    }
}

/**
 * 这个遵守了单一规则；
 * 但是这个花销大，需要对于这个类进行分解
 */

class RoadVehicle{
    public void run(String vehicle){
        System.out.println(vehicle+"在路上面行驶......");
    }
}

class AirVehicle{
    public void run(String vehicle){
        System.out.println(vehicle+"在天空上面行驶......");
    }
}

class WaterVehicle{
    public void run(String vehicle){
        System.out.println(vehicle+"在水里面行驶......");
    }
}
